package tsj.ai.alibaba.data.analysis.util;

import org.springframework.ai.chat.messages.AssistantMessage;
import org.springframework.ai.chat.model.ChatResponse;
import org.springframework.ai.chat.model.Generation;

import java.util.List;

/**
 * @author taoshujian
 * @version 1.0
 * @since 2025-11-14 14:26:09
 */
public class ChatResponseUtil {
    public static ChatResponse createResponse(String statusMessage) {
        return createPureResponse(statusMessage + "\n");
    }

    public static ChatResponse createPureResponse(String message) {
        AssistantMessage assistantMessage = new AssistantMessage(message);
        Generation generation = new Generation(assistantMessage);
        return new ChatResponse(List.of(generation));
    }

    public static String getText(ChatResponse chatResponse) {
        return chatResponse.getResult().getOutput().getText();
    }

}
